package com.sayyi.demo.micro.storage.service;

import com.sayyi.demo.micro.storage.domain.UpdateStorageRequest;
import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

@LocalTCC
public interface StorageTccService {

    @TwoPhaseBusinessAction(name = "StorageTccDeductStorage")
    boolean deductStorage(BusinessActionContext actionContext,
                          @BusinessActionContextParameter(paramName = "request") UpdateStorageRequest updateStorageRequest);

    void commit(BusinessActionContext actionContext);

    void rollback(BusinessActionContext actionContext);
}
